package com.cema.manage.project.android;


import com.cema.manage.invoke.TestAttributeUtils;
import com.cema.manage.invoke.TestJSONDataUtils;
import com.cema.manage.invoke.TestParamUtils;
import com.cema.manage.invoke.interfase.TestAttributeUtilsInterFase;
import com.cema.manage.invoke.interfase.TestJSONDataUtilsInterFase;
import com.cema.manage.invoke.interfase.TestParamUtilsInterFase;
import com.cema.manage.project.manage.users.domain.Users;
import com.cema.manage.redis.RedisService;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


public abstract class TestBaseContrller {
    @Resource
    private RedisService redisService;

    public TestAttributeUtilsInterFase attributeUtilsInterFase;
    public TestJSONDataUtilsInterFase jsonDataUtilsInterFase;
    public TestParamUtilsInterFase paramUtilsInterFase;

    public TestBaseContrller() {
        attributeUtilsInterFase = TestAttributeUtils.getInstance();
        jsonDataUtilsInterFase = TestJSONDataUtils.getInstance();
        paramUtilsInterFase = TestParamUtils.getInstance();
    }

    public Users getUser(HttpServletRequest request) {
        String token = (String) request.getAttribute("token");
        Users users = (Users) redisService.get(token);
        return users;
    }
}
